simulator module¶
The simulator module of FLAME.
This module provides a Simulator class to simulate arbitrary biological pathways as long as they can be modeled as some sets of regulatory relationships supported by FLAME, including PROMOTE, REPRESS, BIPROMOTE.
- class simulator.Simulator¶
Bases: object
The Simulator class.
A simulator object must be initialized with the number of kinds of reactant.
For example:
>>> from simulator import Simulator >>> s = Simulator(5) >>> s.relationship('PROMOTE', 0, 1, [1.0, 8.3e-2, 2e-3, 1e-3, 1.0]) >>> s.relationship('PROMOTE', 2, 3, [1.0, 8.3e-2, 1.2e-1, 2.1e-1, 1.2]) >>> s.relationship('BIPROMOTE', 1, 3, 4, [1.0, 8.3e-2, 0.0, 1.0, 1.0]) >>> s.simulate([1e-2, 1e-2, 0, 0, 0], 100)
- relationship()¶
Add a regulatory relationship between two kinds of reactant.
Parameters: - type (str) –
The type of regulatory relationship.
'PROMOTE' means Reactant 1 promotes Reactant 2. 'REPRESS' means Reactant 1 represses Reactant 2. 'BIPROMOTE' means Reactant 1 and Reactant 2 promote Reactant 3.
- reactant_1 (int) – The index of Reactant 1 (starting from 0).
- reactant_2 (int) – The index of Reactant 2 (starting from 0).
- reactant_3 (int (optional)) – The index of Reactant 3 (starting from 0).
- parameters (list) – A list of the required parameters of the reaction. It should be in the form of [alpha, beta, gamma, K, n].
- type (str) –
- simulate()¶
Start the simulation. You must add some relationships before the simulation.
Parameters: - x0 (list) – A list of the initial concentration of all kinds of reactant.
- t (float) – The simulation time.
Return type: list
Return result: result[i] is a 2-tuple indicating the state of reaction at the i’th moment. result[i][0] is the time, and result[i][1] is a list of the concentration of the reactant at that moment.